a = []
for i in range(3):
    for j in range(3):
        a.append(int(raw_input('Input a number:')))
s = 0
for i in range(3):
    s += a[3*i+i]
print s